# Maintainer: Filipe Laíns (FFY00) <filipe.lains@gmail.com>

pkgname=soapysdr
_pkgname=SoapySDR
pkgver=0.8.1
_gitver=soapy-sdr-$pkgver
pkgrel=4
pkgdesc='Vendor and platform neutral SDR support library'
arch=('loong64' 'x86_64')
url='https://github.com/pothosware/SoapySDR'
license=('Boost')
depends=('python')
makedepends=('cmake' 'swig' 'doxygen' 'graphviz')
optdepends=('soapyairspy: Airspy backend'
            'soapyaudio: Audio devices backend'
            'soapybladerf: BladeRF backend'
            'soapyhackrf: HackRF backend'
            'soapynetsdr: NetSDR backend'
            'soapyosmo: OsmoSDR backend'
            'soapyremote: SoapySDR remote support'
            'soapyrtlsdr: rtl-sdr backend'
            'soapyuhd: UHD backend')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$_gitver.tar.gz")
sha512sums=('50c8f1652bf9ca09215f9c4115175427ca7b5338add7591e31ca0e627093c94b73e7cf7f84fa71ff419cc010d3c1263931506c728bbaa00413a7915d56a87787')

build() {
  mkdir -p $_pkgname-$_gitver/build
  cd $_pkgname-$_gitver/build

  cmake .. \
    -DSOAPY_SDR_EXTVER=ARCH \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release

  make
}

package() {
  cd $_pkgname-$_gitver/build

  make DESTDIR="$pkgdir" install

  install -dm 755 "$pkgdir"/usr/share/doc/$pkgname
  cp -r -a --no-preserve=ownership docs/html "$pkgdir"/usr/share/doc/$pkgname
}
